package com.qingcloud.api.dcengine.service;

import com.qingcloud.api.dcengine.dto.TablePageDTO;
import com.qingcloud.api.dcengine.dto.air.CommonAirData;
import com.qingcloud.api.dcengine.model.air.AirDataListParam;
import com.qingcloud.api.dcengine.model.air.AirDataPageParam;
import com.qingcloud.api.dcengine.service.fallback.AirDataApiFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 城市数据接口
 */
@FeignClient(name = "air-data-api", url = "${data-url}",
        fallback = AirDataApiFallback.class)
public interface AirDataApi {

    /**
     * 小时数据通用列表接口
     */
    @PostMapping("/air/hour/list")
    List<CommonAirData> hourList(@RequestBody AirDataListParam listParam);

    /**
     * 小时数据通用分页查询接口
     */
    @PostMapping("/air/hour/page")
    TablePageDTO<CommonAirData> hourPage(@RequestBody AirDataPageParam pageParam);

    /**
     * 天数据通用列表接口
     */
    @PostMapping("/air/day/list")
    List<CommonAirData> dayList(@RequestBody AirDataListParam listParam);

    /**
     * 天数据通用分页查询接口
     */
    @PostMapping("/air/day/page")
    TablePageDTO<CommonAirData> dayPage(@RequestBody AirDataPageParam pageParam);

    /**
     * 月数据通用列表接口
     */
    @PostMapping("/air/month/list")
    List<CommonAirData> monthList(@RequestBody AirDataListParam listParam);

    /**
     * 月数据通用分页查询接口
     */
    @PostMapping("/air/month/page")
    TablePageDTO<CommonAirData> monthPage(@RequestBody AirDataPageParam pageParam);

    /**
     * 获取天气预报数据
     * @param domainId
     * @param days
     * @return
     */
    @GetMapping("/air/forecast")
    List<CommonAirData> airForecast(@RequestParam("domainId") Integer domainId,
                                  @RequestParam(value = "days", required = false, defaultValue = "4") Integer days);
}
